﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace _4个红外测温仪
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }
        public bool CompensateCanBeRefresh = false;
        private void button1_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.Compensate1 = Convert.ToInt32(textBox1.Text);
            Properties.Settings.Default.Compensate2 = Convert.ToInt32(textBox2.Text);
            Properties.Settings.Default.Compensate3 = Convert.ToInt32(textBox3.Text);
            Properties.Settings.Default.Compensate4 = Convert.ToInt32(textBox4.Text);
            Properties.Settings.Default.Save();
            label9.Text = "已确认";
            label10.Text = "已确认";
            label11.Text = "已确认";
            label12.Text = "已确认";
            CompensateCanBeRefresh = true;

            Form1.Compensate1 = Convert.ToInt32(textBox1.Text);
            Form1.Compensate2 = Convert.ToInt32(textBox2.Text);
            Form1.Compensate3 = Convert.ToInt32(textBox3.Text);
            Form1.Compensate4 = Convert.ToInt32(textBox4.Text);
        }

        private void label9_Click(object sender, EventArgs e)
        {

        }

        private void label10_Click(object sender, EventArgs e)
        {

        }

        private void label11_Click(object sender, EventArgs e)
        {

        }

        private void label12_Click(object sender, EventArgs e)
        {

        }

        private void button2_Click(object sender, EventArgs e)
        {
            textBox1.Text = "0";
            textBox2.Text = "0";
            textBox3.Text = "0";
            textBox4.Text = "0";
            Properties.Settings.Default.Compensate1 = Convert.ToInt32(textBox1.Text);
            Properties.Settings.Default.Compensate2 = Convert.ToInt32(textBox2.Text);
            Properties.Settings.Default.Compensate3 = Convert.ToInt32(textBox3.Text);
            Properties.Settings.Default.Compensate4 = Convert.ToInt32(textBox4.Text);
            Properties.Settings.Default.Save();
            label9.Text = "已重置";
            label10.Text = "已重置";
            label11.Text = "已重置";
            label12.Text = "已重置";
            CompensateCanBeRefresh = true;
            Form1.Compensate1 = Convert.ToInt32(textBox1.Text);
            Form1.Compensate2 = Convert.ToInt32(textBox2.Text);
            Form1.Compensate3 = Convert.ToInt32(textBox3.Text);
            Form1.Compensate4 = Convert.ToInt32(textBox4.Text);
        }

        private void Form2_Load(object sender, EventArgs e)
        {
            textBox1.Text = Properties.Settings.Default.Compensate1.ToString();
            textBox2.Text = Properties.Settings.Default.Compensate2.ToString();
            textBox3.Text = Properties.Settings.Default.Compensate3.ToString();
            textBox4.Text = Properties.Settings.Default.Compensate4.ToString();
            this.ControlBox = false;   // 设置不出现关闭按钮
            
        }

        private void Form2_FormClosed(object sender, FormClosedEventArgs e)
        {
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {

        }

        private void Form2_FormClosing(object sender, FormClosingEventArgs e)
        {

        }

        private void label13_Click(object sender, EventArgs e)
        {

        }
    }
}
